﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using QLDBHYT.DAO;
using QLDBHYT.VO;
using QLDBHYT.BUS;

namespace QLDBHYT
{
    public partial class frmNgaynhap : Form
    {
        public string mahieu;
        public int thang;
        public int nam;
        public string tenhieu;
        public int loai;
        public frmNgaynhap()
        {
            InitializeComponent();
        }

        private void frmNgaynhap_Load(object sender, EventArgs e)
        {
            lblTenhieu.Text = tenhieu;
            PhieunhapBUS phieunhapBUS = new PhieunhapBUS();
            List<PhieunhapVO> lstPhieuNhap;
            if (loai == 0)
            {
                 lstPhieuNhap = phieunhapBUS.GetListNgayNhap(thang, nam, mahieu);
                 this.Text = "Chi tiết nhập";
            }
            else if (loai == 1)
            {

                lstPhieuNhap = phieunhapBUS.GetListSLXUAT(thang, nam, mahieu);
                this.Text = "Chi tiết xuất";
            }
            else
            {
                lstPhieuNhap = phieunhapBUS.GetListNgayXuat(thang, nam, mahieu);
                this.Text = "Chi tiết xuất dc";
            }
            flex.Rows.Count = 1;
            int i = 1;
            foreach (PhieunhapVO phieunhapVO in lstPhieuNhap)
            {
                flex.Rows.Count = flex.Rows.Count + 1;
                flex.Rows[i]["ngaynhap"] = phieunhapVO.Ngaynhap;
                if (phieunhapVO.Slnhap != 0)
                {
                    flex.Rows[i]["Slnhap"] = phieunhapVO.Slnhap;

                }
                i++;
            }
        }
    }
}
